package com.ruoyi.project.monitor.warnmessage.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.monitor.warnmessage.mapper.WarnMessageMapper;
import com.ruoyi.project.monitor.warnmessage.domain.WarnMessage;
import com.ruoyi.project.monitor.warnmessage.service.IWarnMessageService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 告警消息Service业务层处理
 * 
 * @author shixiangwen
 * @date 2020-04-09
 */
@Service
public class WarnMessageServiceImpl implements IWarnMessageService 
{
    @Autowired
    private WarnMessageMapper warnMessageMapper;

    /**
     * 查询告警消息
     * 
     * @param id 告警消息ID
     * @return 告警消息
     */
    @Override
    public WarnMessage selectWarnMessageById(Long id)
    {
        return warnMessageMapper.selectWarnMessageById(id);
    }

    /**
     * 查询告警消息列表
     * 
     * @param warnMessage 告警消息
     * @return 告警消息
     */
    @Override
    public List<WarnMessage> selectWarnMessageList(WarnMessage warnMessage)
    {
        return warnMessageMapper.selectWarnMessageList(warnMessage);
    }

    /**
     * 新增告警消息
     * 
     * @param warnMessage 告警消息
     * @return 结果
     */
    @Override
    public int insertWarnMessage(WarnMessage warnMessage)
    {
        warnMessage.setCreateTime(DateUtils.getNowDate());
        return warnMessageMapper.insertWarnMessage(warnMessage);
    }

    /**
     * 修改告警消息
     * 
     * @param warnMessage 告警消息
     * @return 结果
     */
    @Override
    public int updateWarnMessage(WarnMessage warnMessage)
    {
        warnMessage.setUpdateTime(DateUtils.getNowDate());
        return warnMessageMapper.updateWarnMessage(warnMessage);
    }

    /**
     * 删除告警消息对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteWarnMessageByIds(String ids)
    {
        return warnMessageMapper.deleteWarnMessageByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除告警消息信息
     * 
     * @param id 告警消息ID
     * @return 结果
     */
    @Override
    public int deleteWarnMessageById(Long id)
    {
        return warnMessageMapper.deleteWarnMessageById(id);
    }
}
